﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

//using PowerCreator.LMS.Logic.ProjectManager;
//using PowerCreator.LMS.Logic.Common;
//using PowerCreator.LMS.Logic.FusionCharts;

public partial class sysadmin_CountManager_AllProjectPass : PowerCreator.LMS.Web.Base.BasePage
{
    //ManagerProjectHistoryInfo projectHistoryManager = new ManagerProjectHistoryInfo();
    //ManagerProjectInfo projectManager = new ManagerProjectInfo();

    #region XML数据模版

    //图表抬头 Title, xAxisName=X轴的名称，yAxisName=y轴显示的名称,yAxisMaxValue=y轴最大值
    const string GRAPH = "<graph  caption='全部方案统计'  xAxisName='方案名称列表' yAxisName='通过人数' decimalPrecision='0' formatNumberScale='0' yAxisMaxValue='100' baseFontSize='14'> ";
    //名称，值，颜色
    const string GRAPH_TR = "<set name='{0}' value='{1}' color='{2}' />";
    const string GRAPH_END = "</graph>";
  //  const string REPORT_URL = "/FusionCharts/FCF_Column3D.swf";

    //使用另一个
    const string CHART = "<chart caption='全部方案统计' xAxisName='方案名称列表' yAxisName='通过人数' showValues='0' decimals='0' formatNumberScale='0' yAxisMaxValue='100' baseFontSize='14'>";
    const string CHART_TR = "<set name='{0}' value='{1}'/>";
    const string CHART_END = "</chart>";

    #endregion

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //string xml = GetXML();           
            //if (!string.IsNullOrEmpty(xml))
            //{
            //    litProject.Text = InfoSoftGlobal.FusionCharts.RenderChartHTML(FCTemplate.GetColumn3D(), "", xml, "myFirst", "800", "400", false);
            //}
            //else
            //{
            //    litProject.Text = "没有可进行统计的数据!";
            //}
        }
    }

    private string GetXML()
    {
        StringBuilder sbXML = new StringBuilder();
        //DataTable dt = GetAllProject();
        //if (dt.Rows.Count != 0)
        //{
        //    int passv = 0;
        //    int maxv = 0;
        //    //sbXML.Append(GRAPH);
        //    sbXML.Append(CHART);
        //    int showv = 0;           //计算passv=0时的值个数，用来是否显示该图表
        //    for (int i = 0; i < dt.Rows.Count; i++)
        //    {                
        //        passv = GetProjectPass(int.Parse(dt.Rows[i]["ProjectID"].ToString()), 3);       //通过人数
        //        maxv = GetProjectCount(int.Parse(dt.Rows[i]["ProjectID"].ToString()));          //总人数
        //        if (passv == 0)
        //        {
        //            showv += 1;
        //        }
        //        passv = ReportUtils.GetBaiFenBi(passv.ToString(),maxv.ToString());
        //        sbXML.Append(string.Format(CHART_TR, dt.Rows[i]["ProjectName"], passv));
        //        //sbXML.Append(string.Format(GRAPH_TR, dt.Rows[i]["ProjectName"], passv, ReportUtils.GetColorRander(6)));
        //    }
        //    //sbXML.Append(GRAPH_END);
        //    sbXML.Append(CHART_END);

        //    //if (showv == dt.Rows.Count)
        //    //{
        //    //    sbXML.Remove(0, sbXML.Length);                
        //    //}
        //}
     
        return sbXML.ToString();
    }
    private int GetProjectPass(int projectid,int ispass)
    {
        //string search = string.Format("ProjectID={0} and State={1}",projectid.ToString(),ispass.ToString());
        //return projectHistoryManager.Count(search);
        return 0;
    }
    private int GetProjectCount(int projectid)
    {
        //string search = string.Format(" and ProjectID={0}",projectid);
        //return projectManager.UserStudentProjectListCount(search);
        return 0;
    }
    private DataTable GetAllProject()
    {
        DataTable dt = new DataTable();

        //dt = projectManager.Query("");

        return dt;
    }
}
